<template>
	<view class="center" style="width: 100%;">
		<!-- <cus-nav title="PK赛"></cus-nav> -->
		<view class="title" @click="closeSk"></view>
		<!-- <image :src="'/images/competition/title1.png'|remoteImgSource" style="width: 600rpx;height: 300rpx;"></image> -->
		<image src="../static/img/title.png" style="width: 690rpx;height: 400rpx;"></image>
		<view style="margin-top: 65px;">
			<!-- <cos-btn text="开设房间" @sure="toCreateRom"></cos-btn>
			<cos-btn text="进入房间" @sure="toEnterRom"></cos-btn> -->
			<cos-btn text="智能匹配" @sure="toMatching"></cos-btn>
			<!-- <cos-btn text="比赛记录" @sure="toResultList"></cos-btn> -->
		</view>
	</view>
</template>

<script>
	import cosBtn from '../../components/cos-btn.vue'
	import {getQueryObject} from '../../common/js/util.js'
	export default{
		components:{
			cosBtn
		},
		onLoad(){
			let keyid = '37578'
			let nickname = '小李12'
			let token = 'eyJhbGciOiJSUzI1NiIsImtpZCI6IkY2QzIzQzVFRTc1M0ZGRjNFMjg4NTE4ODY4NzgwRDQwN0ZBNUIzQ0RSUzI1NiIsInR5cCI6ImF0K2p3dCIsIng1dCI6IjlzSThYdWRUX19QaWlGR0lhSGdOUUgtbHM4MCJ9.eyJuYmYiOjE2MzM5NDMzNjMsImV4cCI6MTYzMzk0Njk2MywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo5MDA4IiwiY2xpZW50X2lkIjoiRGV2aWNlQ2xpZW50IiwianRpIjoiODlDM0I0QUYwQ0JDNDBGMURBOTg0OTFFRUZDQjc4NEUiLCJpYXQiOjE2MzM5NDMzNjMsInNjb3BlIjpbImRldmljZS5zY29wZSJdfQ.ni_G7MCmhz4_i4DrF6t-iaevhwwaLIIATbWlr-TLePvwu535-WXb-HgtjItOmIoghZnY7ocCFk0uccqnDiqsmIqpzAwTtzMQGrhrtv-2BsD9uKZmfidqk-rpBTFYfzXhM5fWPwhvTjOCXTdjG5D7ONT5tGb5mv3_hYOrG7H2jNPCN2Fq3U1pyAd4moNz2h_oI7sQenlqU4I9fwrxsI2e6-rBAq9imRJGWPatIe7WGL5BM39yog5TuBXODAZNjlw76Bv7jREg-W-pZHfhX-eWbcgU4Wn2CF8ZOcxKkKm-joXOIcFz0s61Sp1CFTCpNAoqZ_nsM0VjrBlcTv8rT9w5ww'
			let option = getQueryObject()
			
			if(option.appkey){
				uni.setStorageSync('AppKey',  option.appkey)
			}
			if(option.keyid){
				keyid = option.keyid
			}
			if(option.token){
				token = option.token
			}
			if(option.nickname){
				nickname = option.nickname
			}
			// this.$toast(option.token)
			// setTimeout(()=>{
			// 	this.$toast(option.nickname + nickname)
			// }, 4000)
			// setTimeout(()=>{
			// 	this.$toast(option.keyid)
			// }, 8000)
			this.$store.state.user.token = token
			this.$store.state.user.keyid = keyid
			this.$store.state.user.nickname = nickname
		},
		onShow(){
			this.setTitle('知识竞赛')
		},
		methods:{
			closeSk(){
				uni.closeSocket({
					
				})
			},
			toCreateRom(){
				uni.navigateTo({
					url: './createRom'
				})
			},
			toEnterRom(){
				uni.navigateTo({
					url: './enterRom'
				})
			},
			toMatching(){
				uni.navigateTo({
					url: './matching'
				})
			},
			toResultList(){
				uni.navigateTo({
					url: './resultList'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/common/style/public.css';
	.title{
		padding: 30px 0 35px;
		font-size: 26px;
		font-weight: bold;
	}
</style>
<style>
	page{
		background-color: rgba(44,161,255,0.4);
		height: 100%;
	}
</style>
